<?php
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('data_setting', false);
my_component_load('spd_jenis_non_karyawan' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$jid = isset( $_GET['jid'] ) ? $_GET['jid']:  0;
$modulname = "Admin _BN_ Konfigurasi Data _BN_ Jenis Non Kary. (STPD)";
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case   "create" :
			$validatepost = form_validate($id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_jenis_create($id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_jenis_submit($id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break; 
		case   "golongan_page" :
			$validatepost = form_golongan_validate($jid,$id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_golongan_create($jid,$id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_golongan_submit($jid,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break; 	
		case   "form_tarif_page" :
			$validatepost = tarif_validate($jid,$id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_tarif($jid,$id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				tarif_submit($jid,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break; 
		case   "form_keperluan_page" :
			$validatepost = keperluan_validate($jid,$id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_keperluan($jid,$id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				keperluan_submit($jid,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break; 					
		case   "form_kendaraan_page" :
			$validatepost = kendaraan_validate($jid,$id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_kendaraan($jid,$id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				kendaraan_submit($jid,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break; 				
		}

else: 	
	if($task == "edit"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=create&id='.$id , $title , 200	); 
	}elseif($task == "create"){ 
		$content  = form_jenis_create($id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'delete'){ // DELETE ITEM	
		remove_devisi($id);
		my_direct('index.php?com='.$_GET['com']);
	}elseif($task == 'list_golongan'){
		$pagename = "Daftar Golongan Jabatan";
		load_facebox_script();
		$view =  list_golongan($jid); 
		$href='index.php?com='.$_GET['com'].'&task=golongan_create&jid='.$jid;
	}elseif($task == "golongan_create"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=golongan_page&jid='.$jid.'&id='.$id , $title , 200	); 
	}elseif($task == "golongan_page"){ 
		$content  = form_golongan_create($jid,$id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'golongan_delete'){ 
		delete_golongan($id);
		my_direct('index.php?com='.$_GET['com']);
		
	}elseif($task == 'list_tarif'){
		$pagename = "Daftar Tarif Khusus";
		load_facebox_script();
		$view =  list_tarif($jid); 
		$href='index.php?com='.$_GET['com'].'&task=form_tarif&jid='.$jid;
	}elseif($task == "form_tarif"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=form_tarif_page&jid='.$jid.'&id='.$id , $title , 200	); 
	}elseif($task == "form_tarif_page"){ 
		$content  = form_tarif($jid,$id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'tarif_delete'){ 
		delete_tarif($id);
		my_direct('index.php?com='.$_GET['com'].'&task=list_tarif&jid='.$jid);	

	}elseif($task == 'list_keperluan'){
		$pagename = "Daftar Keperluan";
		load_facebox_script();
		$view =  list_keperluan($jid); 
		$href='index.php?com='.$_GET['com'].'&task=form_keperluan&jid='.$jid;
	}elseif($task == "form_keperluan"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=form_keperluan_page&jid='.$jid.'&id='.$id , $title , 200	); 
	}elseif($task == "form_keperluan_page"){ 
		$content  = form_keperluan($jid,$id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'keperluan_delete'){ 
		delete_keperluan($id);
		my_direct('index.php?com='.$_GET['com'].'&task=list_keperluan&jid='.$jid);	

	}elseif($task == 'list_kendaraan'){
		$pagename = "Daftar Kendaraan";
		load_facebox_script();
		$view =  list_kendaraan($jid); 
		$href='index.php?com='.$_GET['com'].'&task=form_kendaraan&jid='.$jid;
	}elseif($task == "form_kendaraan"){
		$title= ($id > '0' ) ?  "Perubahan data" : "Tambah data";
		facebox_page('index.php?com='.$_GET['com'].'&task=form_kendaraan_page&jid='.$jid.'&id='.$id , $title , 200	); 
	}elseif($task == "form_kendaraan_page"){ 
		$content  = form_kendaraan($jid,$id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'kendaraan_delete'){ 
		delete_kendaraan($id);
		my_direct('index.php?com='.$_GET['com'].'&task=list_kendaraan&jid='.$jid);	
	}elseif($task == 'select_all_kendaraan'){ 
		select_all_kendaraan($jid);
		my_direct('index.php?com='.$_GET['com'].'&task=list_kendaraan&jid='.$jid);		
		
	}else{
		$pagename = "Daftar Jenis Non Karyawan ( STPD )";
		load_facebox_script();
		$view =  list_jenis(); 	
		$href='index.php?com='.$_GET['com'].'&task=edit';
	}
endif; 
$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname."" );
?>